import service from "@/service";

//桥梁列表
export function getBridgeList(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/bridgeNameSelect`,
    method: "POST",
    data,
  });
}

//列表
export function getList(data) {
  let { page = 1, pageSize = 10 } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/getList?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

//删除
export function deleteData(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/deleteData?id=${id}`,
    method: "POST",
  });
}

//批量导出
export function exportData(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/exportData`,
    method: "POST",
    apiType: "file",
    responseType: "arraybuffer",
    method: "POST",
    data,
  });
}

//批量导入
export function importExcel(formdata) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/importExcel`,
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formdata,
  });
}

//物料入库-模板下载
export function downloadMaterialInTemplate(parameter) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/downloadTemplate`,
    method: "GET",
    apiType: "file",
    responseType: "arraybuffer",
    params: parameter,
  });
}

//保存/更新梁信息
export function saveOrUpdateData(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/saveOrUpdateData`,
    method: "POST",
    data,
  });
}

//查看详情
export function getDetail(data) {
  let { id } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/lcBeamInfo/getDetail?id=${id}`,
    method: "POST",
    data,
  });
}
